<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<html>
<head>
	
</head>
<body style="">

	<script src="http://libs.baidu.com/jquery/1.9.1/jquery.min.js"></script>
	<script src="/statics/layui/layer.js"></script>
    <script src="/statics/layui/laypage.js"></script>
<style type="text/css">
	body{position: relative;position: }
</style>
<div style="position: fixed;right:100px;top:100px;">
	<button style="height:30px;"><a href="javascript:if(confirm('确实要导出订单?'))location='?m=member&c=member&a=outPutOrder&pc_hash=<?php echo $_SESSION['pc_hash']?>'">导出订单</a></button>
</div>
<div style="position: fixed;right:100px;top:150px;">
	<button style="height:30px;"><a href="javascript:if(confirm('确实要删除订单?'))location='?m=member&c=member&a=del30DaysOrder&pc_hash=<?php echo $_SESSION['pc_hash']?>'">一键删除60天前订单</a></button>
</div>


<div class="container" style="margin-top: 20px;">
    <style type="text/css">
				.table-d { background:#000;color:#000;font-size: 20px;text-align: center;width: 100%;margin-bottom: 20px;} 
				.table-d  td{ background:#FFF;/* sfont-weight: bolder; */padding: 5px 5px;overflow: hidden;} 
				.table-d td span{color: #c00}
				.table-d textarea{font-size: 12px;}
				.table-d td img{width: 200px;}
				.order_title div{float: left;color:#000;font-size: 18px;margin-bottom:10px;padding: 5px;}
				.order_title .btn{width:100px;text-align: center;}
				.order_title .tips{margin-left: 20px;}
	</style>
	<script type="text/javascript">
		$(function(){
			
			$(".addAskQuestion").click(function(){
				
				var obj=$(this).parents().parents().parents().parents().parents();
				obj.find('input[name=submitType]').val('askType');
				obj.submit();
				
			})
			$(".addOrderQuestion").click(function(){
				
				var obj=$(this).parents().parents().parents().parents().parents();
				obj.find('input[name=submitType]').val('orderType');
				obj.submit();
			
			})

			$('.order-list').each(function(){
				var orderid=$(this).find('.getAskDetail').attr('data-orderid');
				var obj=$(this);
				$.get("?m=member&c=member&a=queryOrderDetailByOrderId&pc_hash=<?php echo $_SESSION['pc_hash']?>",{orderid:orderid},function(data){
					console.log(orderid)
					console.log(data)
					obj.find(".user-order-question").html(data['user_order_question'])
					obj.find(".user-ask-question").html(data['user_ask_question'])
					obj.find(".admin-ask-question").html(data['admin_ask_question'])
				},'json')
			})

            //搜索
            //$("#form-name" )
            $("#sousuo-btn" ).click(function(){
                var name=$("#form-name" ).val();
                var href = location.href;
                var s = href.replace( /&name=\w+/, "" )
                location.href=s+"&name="+name;
            })


		})

		function addAskQuestion(order_id,goods_id)
		{

			$('#other').click(function() {
			  $('#target').submit();
			});
			/*$.post('url',{'order_id':order_id,'goods_id':goods_id,},function(data){

			})*/
		}
		function addOrderQuestion()
		{

		}
	</script>
	<div class="page-box"><div id="page"></div></div>
    <p style="display: inline-block;margin: 10px 5px;">按姓名搜索:&nbsp;&nbsp;<input id="form-name" value="<?=$_GET['name']?>"><button id="sousuo-btn">搜索</button><span style="font-size: 10px;color: #FF0000">&nbsp;&nbsp;如果没有显示结果则搜索内容内容</span></p>
	<table width="1070px;" style="margin:0 auto;">
		<?php foreach ($res as $key => $val) {?>
			
		<tr class="order-list">
			<td>
				<form class="form" action="?m=member&c=member&a=submitAskQuestion&pc_hash=<?php echo $_SESSION['pc_hash']?>" method="post">
				<table class='table-d'  border="0" cellspacing="1" cellpadding="0" style="margin:0px;">
                    <?php if($key==0){?>
				<tr style="font-size:20px;">
					<td width="50px">ID</td>
					<td style="width:90px;">用户</td>
					<td width="100px" height="50px">商品名称</td>
					<td style="width:206px;padding:0px;">사진.图片</td>
					<td style="width:70px;">단가.单价</td>
					<td style="width:300px;">단가.订单</td>
					<td style="width:300px;">문의.咨询</td>
					<td style="width:300px;">글쓰기.留言</td>
					<td style="width:300px;">新增提交</td>
					<!-- <td>글쓰기.留言</td> -->
					<td style="width:99px;">보내기.提交</td>
				
				</tr>
				<?php }?>
				<tr style="height:64px;overflow: hidden;font-size:16px;" data-orderid='<?php echo $val[id]?>' class='getAskDetail'>
					<td width='50px'><?php echo $val[id]?></td>
					<td style="width:90px;"><?php echo $val[username]?></td>
					<td width="100px" height="50px"><div sytle=""><a target="_blank" href='<?php echo $val['url']?>'><?php echo $val[title]?></a></div></td>
					<td style="width:206px;padding:0px;"><a target="_blank" href='<?php echo $val['url']?>'><img style="margin:0px;width:200px;" src="<?php echo $val[thumb]?>"/></a></td>
					<td  style="width:70px;"><?php echo $val[price]?></td>
					<td  style="width:300px;" class='user-order-question'><!--user_order_question--><?php echo $val['user_order_question']?></td>
                    <td class='user-ask-question' valign="top" style="width:300px;text-align:left;font-size:16px;"><?php echo $val['user_ask_question']?></td>

                    <td class='admin-ask-question' valign="top" style="width:300px;text-align:left;font-size:16px;"><?php echo $val['admin_ask_question']?></td>
                    <td style="width:300px;">
                        <textarea style="font-size:20px;width:100%;height:190px;margin:0px;border:none;" rows="20" cols="20" name="info" id="content{$key}" boxid="content"></textarea>
                    </td>
					<td width="99px" style="font-size:18px;">
                        <span class="addAskQuestion">新增提交</span>
                        <br/><br/><br/><br/>
						<a class="del-order" href="javascript:if(confirm('确实要删除该内容吗?'))location='?m=member&c=member&a=delOrder&orderid=<?php echo $val['id']?>&pc_hash=<?php echo $_SESSION['pc_hash']?>'" style="background:#FFFF00;margin-bottom:10px;cursor:pointer">删除</a>
						<input name="order_id" class='order-id' type='hidden' value='<?php echo $val[id]?>'/>
						<input name="goods_id" class='goods-id' type='hidden' value='<?php echo $val[goodsid]?>'/>
						<input name="submitType" type='hidden' value=''/>
						</td></td>
				
				</tr>

				<!--<tr style="border:none;">
					<td border='0' colspan="8" style="padding:0px;border:none;">
						<table  class='table-d ask-table' style="margin:0"  border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td width="73px" style="border-right:1px solid #000;border-bottom:1px solid #000;">类型</td>
								<td style="width:409px;border-right:1px solid #000;border-bottom:1px solid #000;">내용.内容</td>

								<td style="width:447px;border-right:1px solid #000;border-bottom:1px solid #000;">답글.答复</td>
								<td style="width:115px;border-bottom:1px solid #000;"><span data-orderid='<?php /*echo $val[id]*/?>' class='getAskDetail' href='javascript:void(0)'>查看订单<br/>详情</span></td>
							</tr>
							<tr>
								<td  style="background:#FFFF00;color:#000;border-right:1px solid #000;border-bottom:1px solid #000;"><span>문의<br/>咨询</span></td>
								<td class='user-ask-question' valign="top" style="text-align:left;font-size:16px;border-right:1px solid #000;border-bottom:1px solid #000;"><?php /*echo $val['user_ask_question']*/?></td>
								<td class='admin-ask-question' valign="top" style="text-align:left;font-size:16px;border-right:1px solid #000;border-bottom:1px solid #000;"><?php /*echo $val['admin_ask_question']*/?></td>
								<td  style="background:#FFFF00;color:#000;border-bottom:1px solid #000;"><span class="addAskQuestion">新增提交</span></td>
							</tr>
							<tr>
								<td style="background:#00B0F0;color:#000;border-right:1px solid #000;"><span style="background:#00B0F0;color:#000;">글쓰기<br/>留言</span></td>
								<td colspan="8" valign="top" style="text-align:left;font-size:16px;border-right:1px solid #000;">
									<textarea style="font-size:20px;width:100%;height:50px;margin:0px;border:none;" rows="20" cols="20" name="info" id="content{$key}" boxid="content"></textarea>
								</td>


							</tr>
						</table>
					</td>
					
				</tr>-->
			</table>
		</div>
			</form>
			</td>
		</tr>
		
		<?php }?>
	</table>

</div>
<script>
	/*var index = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
	//loading层
	var index = layer.load(1, {
	shade: [0.1,'#fff'] //0.1透明度的白色背景
	});*/
	laypage({
        cont: 'page',
        pages: <?=$page_count;?>, //可以叫服务端把总页数放在某一个隐藏域，再获取。假设我们获取到的是18
        curr: function(){ //通过url获取当前页，也可以同上（pages）方式获取
            var page = location.search.match(/page=(\d+)/);
            return page ? page[1] : 1;
        }(),
        jump: function(e, first){ //触发分页后的回调
            if(!first){ //一定要加此判断，否则初始时会无限刷新
			//console.log(location.href+'&page='+e.curr)
			var url=location.href;
			location.href=url.split('&page=')[0]+'&page='+e.curr;
                //location.href = location.href+'&page='+e.curr;
            }
        }
    });
</script>
</body>
</html>